// 导入vue 和 vueX
import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
    state:{
        routes:[],
        currentUser: JSON.parse(window.sessionStorage.getItem('user')),
    },
    // 同步
    mutations: {
        initRoutes(state,data){
            state.routes = data;
        },
        initUser(state,user){
            state.currentUser = user;
        }
    },
    // 异步
    actions: {

    }
})
